package com.chixing.day05.oop;

/**
 * 设计Person类
 * 要求判断两个person对象是否满足结婚条件
 * 属性:
 * 姓名、年龄、性别、是否结婚
 * (1)两人均未婚
 * (2) 必须是异性
 * (3)男性年龄>=24，女性年龄>=22
 * 满足以上三个条件就可以结婚。
 * 设计Person类，属性与方法，并创建对象进行测试
 */
public class Person {
    private String personName;
    private int personAge;
    private boolean isMale;
    private boolean isMarried;
    public Person(String personName,int personAge,
                         boolean isMale,boolean isMarried){
        this.isMale=isMale;
        this.personAge=personAge;
        this.personName=personName;
        this.isMarried=isMarried;
    }
    public boolean canMarry(Person other) {
        if (!this.isMarried && !other.isMarried) {
            if (!this.isMale && other.isMale) {
                if ((this.isMale = true && this.personAge >= 24) || (this.isMale = false && this.personAge >= 22)){

                }

            }
        }
        return false;

    }

}
